%This file creates a Tangent (Meshikim) cluster example
%Creating 3 tangent clusters in 2 dimensions

r = 5; %The radius
cluster_size = 30;
centers = get_3_tangent_circles_centers( r );
C1 = create_cluster(centers(1,:)', [r/2,r/2]', 30);
C2 = create_cluster(centers(2,:)', [r/2,r/2]', 30);
C3 = create_cluster(centers(3,:)', [r/2,r/2]', 30);
C = [C1, C2, C3];
my_ones = ones(1,cluster_size);
colors = [my_ones, my_ones*2, my_ones*3];

figure;
hold on;
scatter(C(1,:), C(2,:), [], colors');

[x1, y1] = get_circle(centers(1,:), r);
[x2, y2] = get_circle(centers(2,:), r);
[x3, y3] = get_circle(centers(3,:), r);

plot(x1,y1,x2,y2,x3,y3);
axis equal;
hold off;

figure;
classification = kmeans(C',3);
hold on;
scatter(C(1,:), C(2,:), [], classification');
plot(x1,y1,x2,y2,x3,y3);
axis equal;
hold off;
